<?php
require_once('../db/check_login.php');
require_once('../db/config.php');
$db=new db($config);
$getPraiseId=$_GET['getPraiseId'];
$userIp=$_GET['userIp'];
$row=$db->countbyWhere('commentpraise',"praise_Id='$getPraiseId' and ip='$userIp'");

if($row==0){
$data=array(
'praise_Id'=>$getPraiseId,
'num'=>1,
'ip'=>$userIp
);
$db->insert('commentpraise',$data);
$num=$db->countbyWhere('commentpraise',"praise_Id='$getPraiseId'");
echo json_encode(array("errorCode"=>0,"num"=>$num,));	
}else{
echo json_encode(array("errorCode"=>1,"msg"=>"你已经赞过!"));	
}

?>